package org.smart4j.framework.util;


import org.apache.commons.lang3.StringUtils;

/**
 * Created by Wangminze on 2016/12/10.
 * description: 字符串工具类
 */
public final class StringUtil {

    /** 字符串分隔符 **/
    public static final String SEPARATOR = String.valueOf((char)29);

    /**
     * @param str
     * @return
     * author: Wangminze
     * date: 2016/12/10
     * description: 判断字符串是否为空
     */
    public static boolean isEmpty(String str){
        if (str != null){
            str = str.trim();
        }
        return StringUtils.isEmpty(str);
    }

    /**
     * @param str
     * @return
     * author: Wangminze
     * date: 2016/12/10
     * description: 判断字符串是否非空
     */
    public static boolean isNotEmpty(String str){
        return !isEmpty(str);
    }

    /**
     * 将原字符分割成字符串数组
     *
     * @param sourceStr
     * @param splitStr
     * @return
     */
    public static String[] splitString(String sourceStr, String splitStr) {
        return sourceStr == null ? null : sourceStr.split(splitStr);
    }
}
